var path="http://localhost:8080/ddln-order";
var total=0;
var pageSize=0;

$(function(){ 
	//初始加载全部订单
	listOrder();
	$('.m-style').pagination({    
		totalData: total,
		showData: pageSize,
		coping: true,
		callback: function (api) { 
			$("#pageIndex").val(api.getCurrent());
			listOrder();;  
        }
	});     
	$("#queryOrder").click(function(){     
		listOrder();  
		$('.m-style').pagination({    
			totalData: total,
			showData: pageSize,
			coping: true,
			callback: function (api) { 
				$("#pageIndex").val(api.getCurrent());
				listOrder();;  
	        }
		});  
	});
});
function listOrder() {
	var orderForm=$("#queryOrderData");
	var t = orderForm.serialize();
    $.ajax({ 
		type:"POST",
		url:path+"/order/order/listOrder", 
		data:t,       
		dataType:"json",
		async: false,   
		success:function(data){  
			if(data.success=="true"){ 
				total=data.data.total;	
				pageSize=data.data.pageSize;
				var dom=$("#orderData"); 
				dom.html("");   
				for (var i = 0; i < data.data.rows.length; i++) {
					
					var status="";
					var pay_status="";
					var ship_status="";
					var payment="";
					
					if(data.data.rows[i].status=="0"){
						status="已取消"
					}else{
						status="已提交"
					}
					
					if(data.data.rows[i].pay_status=="0"){
						pay_status="未付款"
					}else{
						pay_status="已付款"
					}
					

					if(data.data.rows[i].ship_status=="0"){
						ship_status="未发货"
					}else{
						ship_status="已发货"
					}
					
					if(data.data.rows[i].payment_id=="1"){
						payment="支付宝支付"
					}else if(data.data.rows[i].payment_id=="2"){
						payment="微信支付"
					}else{
						payment="账户余额"
					}
					
					
					var s=$('<tr class="el-table__row">'+
							'<td class="el-table_1_column_182 is-center el-table-column--selection">'+
							'<div class="cell"><label role="checkbox" class="el-checkbox"><span aria-checked="mixed" class="el-checkbox__input"><span class="el-checkbox__inner"></span><input type="checkbox" class="el-checkbox__original" value=""></span><!----></label></div>'+
						'</td>'+
						'<td class="el-table_1_column_183 is-center ">'+
							'<div class="cell">'+data.data.rows[i].order_id+'</div>'+
						'</td>'+
						'<td class="el-table_1_column_184 is-center ">'+
							'<div class="cell">'+data.data.rows[i].sn+'</div>'+
						'</td>'+
						'<td class="el-table_1_column_185 is-center ">'+
							'<div class="cell">'+data.data.rows[i].member.name+'</div>'+
						'</td>'+
						'<td class="el-table_1_column_186 is-center ">'+
							'<div class="cell"><span data-v-be8f4ab8="">'+data.data.rows[i].order_amount+'</span>'+
								'<div data-v-be8f4ab8="" style="color: rgb(216, 220, 229);">(含运费0)</div>'+
							'</div>'+
						'</td>'+
						'<td class="el-table_1_column_187 is-center ">'+
							'<div class="cell">'+data.data.rows[i].create_time+'</div>'+
						'</td>'+
						'<td class="el-table_1_column_188 is-center ">'+
							'<div class="cell">'+
								'<!---->'+
								'<!----><span data-v-be8f4ab8="">'+status+'</span>'+
								'<!---->'+
							'</div>'+
						'</td>'+
						'<td class="el-table_1_column_189 is-center ">'+
							'<div class="cell"><span data-v-be8f4ab8="">'+pay_status+'</span>'+
								'<!---->'+
								'<!---->'+
							'</div>'+
						'</td>'+
						'<td class="el-table_1_column_190 is-center ">'+
							'<div class="cell">'+payment+'</div>'+
						'</td>'+
						'<td class="el-table_1_column_191 is-center ">'+
							'<div class="cell"><span data-v-be8f4ab8="">'+ship_status+'</span>'+
								'<!---->'+
								'<!---->'+ 
							'</div>'+
						'</td>'+
						'<td class="el-table_1_column_192 is-center ">'+
							'<div class="cell">普通快递</div>'+
						'</td>'+
						'<td class="el-table_1_column_193 is-center ">'+
							'<div class="cell">'+
								'<a data-v-be8f4ab8="" title="订单管理" class="t-order"></a>'+ 
								'<a data-v-be8f4ab8="" href="admin-order-detail.html?orderId='+data.data.rows[i].order_id+'" title="修改" class="t-edit"></a>'+
								'<a data-v-be8f4ab8="" title="删除" class="t-del"></a>'+
							'</div>'+
						'</td>'+
					'</tr>');
					dom.append(s);
				}
				
			}else{ 
			}
		   
		    
		},
		error:function(data){ 
			//alert("对不起，加载失败");
		}
	});
}
$(function () {
	
	
})
